programming4us
           
 
 
Sharepoint

Examples of SharePoint Administrative Tasks (part 1) - Deploying SharePoint 2010 with Windows PowerShell Scripts

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
12/14/2010 5:08:58 PM
Many administrative tasks must be completed on a daily basis, some are needed only occasionally, and then there are those few that are rarely required. Windows PowerShell can help with all of these types of tasks; in fact, you may discover that it is more critical to script a rarely executed task than one you perform every day. This may be because you need to execute that rare task quickly and correctly, because the ramifications of making even a small mistake while completing the task could be catastrophic. Throughout this book, you will see many examples of when and how to use Windows PowerShell. In the following sections, you explore a few examples that you may not have seen elsewhere.

Note:

SEE ALSO There is a section of the Microsoft Script Center, http://gallery.technet.microsoft.com/ScriptCenter/en-us, that contains SharePoint-related scripts.


1. Deploying SharePoint 2010 with Windows PowerShell Scripts

During the lifetime of your SharePoint installation, there may be many tasks that you must complete (hopefully) only once, such as installing SharePoint and creating your farm. In large organizations with a variety of environments and many developers to support, however, you may find it prudent to develop scripts right from the outset that will build your SharePoint Web front-end (WFE) servers and your SharePoint applications servers, which host your applications services, such as InfoPath Services and search query and indexing services. In previous versions of SharePoint, you could complete such tasks using batch files and the SharePoint command-line tools psconfig and stsadm. You can still use these tools to automate the installation of your SharePoint 2010 and SharePoint Foundation 2010 servers.The order of these commands and parameters can be quite tricky, so Microsoft recommends that you use the Windows PowerShell module, SPModule, documented in the Microsoft’s TechNet library article, “Install SharePoint Server 2010 by using Windows PowerShell”, at http://technet.microsoft.com/en-us/library/cc262839.aspx.


Note:

MORE INFO For information about SharePoint automation and the use of psconfig, stsadm, and Windows PowerShell, see http://stsadm.blogspot.com/.


When you work on a SharePoint installation, you will need to merge the logs. The Windows operating systems provide you with event logs to help you with your administrative tasks, and you can use the Windows PowerShell Get-Eventlog cmdlet to obtain detailed information from those logs. SharePoint also provides the Unified Logging Service (ULS). The ULS contains all application log events, and third-party logging software can be integrated into them as well. SharePoint 2010 includes several Windows PowerShell cmdlets for retrieving information and configuring the ULS. To find how ULS is configured on your farm, type the following command. (The sample output for this command is also shown here.)

Get-SPDiagnosticConfig


AllowLegacyTraceProviders                   : False
CustomerExperienceImprovementProgramEnabled : True
ErrorReportingEnabled : True
ErrorReportingAutomaticUploadEnabled : True
DownloadErrorReportingUpdatesEnabled : True
DaysToKeepLogs : 14
LogMaxDiskSpaceUsageEnabled : True
LogDiskSpaceUsageGB : 3
LogLocation : %CommonProgramFiles%\Microsoft Sh
ared\Web Server Extensions\14\LOG
S\
LogCutInterval : 30
EventLogFloodProtectionEnabled : True
EventLogFloodProtectionThreshold : 5
EventLogFloodProtectionTriggerPeriod : 2
EventLogFloodProtectionQuietPeriod : 2
EventLogFloodProtectionNotifyInterval : 5
ScriptErrorReportingEnabled : True
ScriptErrorReportingRequireAuth : True
ScriptErrorReportingDelay : 60


When diagnosing a problem, you can use cmdlets associated with the SPLogEvent object. You need machine administrator privileges to run these cmdlets, so you may need to start SharePoint 2010 Management Shell using Run As Administrator. Then you would use commands in steps similar to those shown in the following example.

  1. Set up two variables to store the start day and the end date, for example.

    $SDate = Get-Date -Day 13 -Month 04 -Year 2010
    $EDate = Get-Date -Day 14 -Month 04 -Year 2010

    Or the date could be today’s date, but the event occurred approximately 15 minutes earlier than the current time. In this case, you set the variable to 20 minutes before the current time and 10 minutes before the current time.

    $SDate = (Get-Date).AddMinutes(-20)
    $EDate = (Get-Date).AddMinutes(-10)

  2. Obtain a list of events between those two dates and times.

    Get-SPLogEvent -StartDate $SDate -EndTime $Edate

    If the –EndTime parameter is not provided, the event logs will be displayed up until the current date and time.

A tracking number, known as the Correlation ID, is associated with each request you make to SharePoint. This number is stored as a value in a property associated with the SPLogEvent object. SQL Profiler traces also show the Correlation IDs. This number is displayed on an Error page, as shown in Figure 1.

Figure 1. Error page showing the Correlation ID


In a large or heavily used SharePoint installation, many logs may be produced during the period when a problem occurs. You can use the Correlation ID to help troubleshoot errors by reducing the amount of log information that is returned to those entries that are associated with the incident. Again, set the $sdate and the $edate variables to reflect the time around the incident. For an incident that you can’t reproduce and one of your users always can reproduce, you might tell the help desk to ask the user to take a screenshot of the error page so you can be sure to obtain the exact Correlation ID number. Then you can pipe the results of the command shown in step 2 to the Where-Object cmdlet, as shown in the following example.

PS C:\Users\Peter>Get-SPLogEvent -StartDate $SDate -EndTime $EDate |
where {$_.Correlation -eq "68bc5cf4-5a8c-4517-a879-86e35e57c862"}
The output will display only event logs between the two dates that are related to the problem associated with that Correlation ID.
Other -----------------
- SharePoint 2010 : Add a Web Part
- SharePoint 2010 : Use the Picture Editing Control in a Page
- SharePoint 2010 : Use Wiki Syntax to Link to Existing Content and Create Pages
- Sharepoint 2010 : Use the Text Editing Control in a Page (part 3) - Add and Edit a Table
- Sharepoint 2010 : Use the Text Editing Control in a Page (part 2) - Add and Edit a Picture
- Sharepoint 2010 : Use the Text Editing Control in a Page (part 1) - Add a Hyperlink
- Working with the SharePoint 2010 Management Shell (part 9) - Performing Basic Administrative Tasks
- Working with the SharePoint 2010 Management Shell (part 8)
- Working with the SharePoint 2010 Management Shell (part 7) - Using Parameters
- Working with the SharePoint 2010 Management Shell (part 6)
- Working with the SharePoint 2010 Management Shell (part 5) - Using Verbs
- Working with the SharePoint 2010 Management Shell (part 4) - Understanding Properties and Methods
- Working with the SharePoint 2010 Management Shell (part 3) - Working with Objects
- Working with the SharePoint 2010 Management Shell (part 2) - Understanding cmdlets
- Working with the SharePoint 2010 Management Shell (part 1)
- SharePoint 2010 : Edit the Contents of a Page
- SharePoint 2010 : Change the Page Layout of a Publishing Page
- SharePoint 2010 : Authoring Pages - Edit the Properties of a Page
- SharePoint 2010 : Authoring Pages - Create a New Page (part 2)
- SharePoint 2010 : Authoring Pages - Create a New Page (part 1)
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us